//
//  QSRequestManager.h
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/3/23.
//  Copyright © 2020 DingC. All rights reserved.
//

#import <Foundation/Foundation.h>

@class ResponseMessage;
@class QSUploadImage;
@class QSUploadVideo;

@interface QSRequestManager : NSObject
/**
 * @brief POST请求 content-type : FORM
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)executePOST:(NSString *)requestUrl
                           requestBody:(NSMutableDictionary *)bodyDic
                              andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;

/**
 * @brief GET请求 content-type : FORM
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)executeGET:(NSString *)requestUrl
                           requestBody:(NSMutableDictionary *)bodyDic
                              andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;

/**
* @brief GET请求 返回数组
*
* @param requestUrl   请求url
* @param bodyDic      请求param
* @param block        请求返回的数据
*
* @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
*/
+ (NSURLSessionTask *)executeTokenReturnArrayGET:(NSString *)requestUrl
                                     requestBody:(NSMutableDictionary *)bodyDic
                                        andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSArray *responseArr))block;

/**
 * @brief 带有token的POST请求 content-type : FORM
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)executeTokenPOST:(NSString *)requestUrl
                      requestBody:(NSMutableDictionary *)bodyDic
                         andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;

/**
 * @brief 带有Token的POST请求 content-type : JSON
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)executeJSONTokenPOST:(NSString *)requestUrl
                               requestBody:(NSMutableDictionary *)bodyDic
                                  andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;

/**
 * @brief 带有token的GET请求 content-type : FORM
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)executeTokenGET:(NSString *)requestUrl
                           requestBody:(NSMutableDictionary *)bodyDic
                              andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;

/**
 * @brief 带有token的上传图片请求
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param photos       请求上传的图片数组(类型是QSUploadImage)
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)excuteTokenUpload:(NSString *)requestUrl
                            requestBody:(NSMutableDictionary *)bodyDic
                                 photos:(NSArray<QSUploadImage *> *)photos
                               andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;

/**
 * @brief 带有token的上传图片或者上传视频的请求
 *
 * @param requestUrl   请求url
 * @param bodyDic      请求param
 * @param photos       请求上传的图片数组(类型是QSUploadImage)
 * @param block        请求返回的数据
 *
 * @return NSURLSessionTask 该次请求的task 可取消请求,调用cancel方法
 */
+ (NSURLSessionTask *)excuteTokenUpload:(NSString *)requestUrl
                            requestBody:(NSMutableDictionary *)bodyDic
                                 photos:(NSArray<QSUploadImage *> *)photos
                                 videos:(NSArray<QSUploadVideo *> *)videos
                               andBlock:(void (^)(ResponseMessage *rspStatusAndMessage, NSDictionary *responseDataDic))block;
@end

